local huojian = fk.CreateSkill {
  name = "cf_huojian"
}

Fk:loadTranslationTable {
  ["cf_huojian"] = "火箭",
  [":cf_huojian"] = "每回合限两次，你可以摸一张牌并视为使用一张【火攻】，当此【火攻】造成伤害后，你摸一张牌。",
  ["#cf_huojian"] = "你可以摸一张牌并视为使用【火攻】",
  ["$cf_huojian1"] = "百发百中！",
  ["$cf_huojian2"] = "箭如雨下！",
}

huojian:addEffect("viewas",
  {
    card_filter = function(self, player, to_select, selected, selected_targets)
      return false
    end,
    filter_pattern = {
      min_num = 0,
      max_num = 0,
      pattern = "",
      subcards = {},
    },
    view_as = function(self, player, cards)
      local card = Fk:cloneCard("fire_attack")
      card.skillName = huojian.name
      return card
    end,
    prompt = "#cf_huojian",
    enabled_at_play = function(self, player)
      return player:usedSkillTimes(huojian.name, player.HistoryTurn) <= 1
    end,
    before_use = function(self, player, use)
      player:drawCards(1, huojian.name)
    end,
  })

huojian:addEffect(fk.DamageFinished, {
  can_refresh = function(self, event, target, player, data)
    return player:hasSkill(huojian.name) and data.card.skillName and data.card.skillName == huojian.name and
        data.from == player
  end,
  on_refresh = function(self, event, target, player, data)
    player:drawCards(1, huojian.name)
  end
})

return huojian
